<me:UIVRP x:Class="WPFExcelReport.TVRPOS"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"   
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                     xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:VRK="clr-namespace:WPFExcelReport;assembly=TVRKOPF"
                     xmlns:VKP="clr-namespace:WPFExcelReport;assembly=TVKPOS"
                    xmlns:KD="clr-namespace:WPFExcelReport;assembly=TKDSTAMM"  
                    xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR" 
                     Background="White"  
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIVRP.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:Divideby100 x:Key="d100"/>
        <ucd:PNumConverter x:Key="pnum"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIVRP.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition> 
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <WrapPanel  Grid.Row="0"  VerticalAlignment="Top"> 
            <Grid Margin="10,0,0,0" VerticalAlignment="Top"  >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=订单号}}"/>
                <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2" PRE="  "   IsAutoClear="True" CharacterCasing="Upper" 
                              Text="{Binding KRS,ElementName=TV}" Width="30" />
                <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="6"  IsAutoClear="True" PRE="000000" 
                              Text="{Binding LFD,ElementName=TV}"  Width="90" />
                
            </Grid>
            <Grid Margin="10,0,0,0" VerticalAlignment="Top"    >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock  Text="{Binding Source={Localization:Translate Word=客户}}"/>
                <KD:TSKD02 Grid.Column="1" MinWidth="100" KEY="{Binding Path=KUNDNR,ElementName=TV}"  
                               Width="150" />
            </Grid>
            <Grid Margin="10,0,0,0" VerticalAlignment="Top"   >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=已付}}"/>
                <CheckBox  Grid.Column="1"  IsChecked="{Binding IsPaid,ElementName=TV}"></CheckBox> 
            </Grid>
            <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Grid.Column="0"  Click="ConfirmPaymentCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                    </Button.Background>
                </Button>
                <TextBlock Grid.Column="2" FontSize="16" Text="{Binding Source={Localization:Translate Word=确认支付}}"/> 
            </Grid>
            <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Grid.Column="0"  Click="ConfirmPaymentCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                    </Button.Background>
                </Button>
                <TextBlock Grid.Column="1" FontSize="16" Text="{Binding Source={Localization:Translate Word=确认支付}}"/>
                <Button Grid.Column="2" Content="{Binding Source={Localization:Translate Word=确认金额}}" Click="ConfirmPaymentCommand" Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}"/>
                <ex:NumericBox Grid.Column="3" Width="40" Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}"
                                   Text="{Binding SQTY,ElementName=TV}"/>
                <TextBlock Grid.Column="4" Text="{Binding Source={Localization:Translate Word=待处理现金}}"></TextBlock>
                <TextBlock Grid.Column="5" Text="{Binding KDAUFBEST,ElementName=TV}"></TextBlock>                
            </Grid>
            <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Grid.Column="0"  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                    </Button.Background>
                </Button>
                <TextBlock Grid.Column="2" FontSize="16" Text="{Binding Source={Localization:Translate Word=查询}}"/>
            </Grid> 
            <Grid Margin="10,0,0,0" VerticalAlignment="Top"   >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <DR:TDRAUFTR  Grid.Column="0" Name="cDR" DocType="{Binding PRTYPE,ElementName=TV}" PrintType="OpenExcel" />
                <Button  Grid.Column="1"   Click="btnPrint_Click" Height="20" Margin="5,0,0,0" Width="Auto" Content="{Binding Source={Localization:Translate Word=打印发票}}" />
            </Grid>
        </WrapPanel>
        <DataGrid  Grid.Row="1"  
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"   
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True"
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible" Grid.ColumnSpan="2" Margin="0,0.2,0.2,0"
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=VRPKOLL,Converter={StaticResource ResourceKey=gb2312} }"  Header="{Binding Source={Localization:Translate Word=季节}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPART,Converter={StaticResource ResourceKey=gb2312}}"  Header="{Binding Source={Localization:Translate Word=纱线}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPFARBE,Converter={StaticResource ResourceKey=gb2312}}"  Header="{Binding Source={Localization:Translate Word=色号}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPAUFKRS, Mode=TwoWay}"   Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPAUFLFD, Converter={StaticResource ResourceKey=pnum}}"   Header="{Binding Source={Localization:Translate Word=销售单}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPAUFPOS, Converter={StaticResource ResourceKey=pnum}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPAENB,  Mode=TwoWay}"  Header="{Binding Source={Localization:Translate Word=修改}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPAEND, Mode=TwoWay}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPNEUB, Mode=TwoWay}" Header="{Binding Source={Localization:Translate Word=创建}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPNEUD,  Mode=TwoWay}"  Header="{Binding Source={Localization:Translate Word=日期}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPMENGET4, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=KG}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPGESWERT, Converter={StaticResource ResourceKey=d100}}"  Header="{Binding Source={Localization:Translate Word=金额}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VRPRENR, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:Translate Word=发票号}}" Width="Auto" />

            </DataGrid.Columns>
        </DataGrid  >
        <VRK:TVR04 Grid.Row="2" 
                    IsAuto="True"
                   ORDERNUM="{Binding KEY,ElementName=TV,Mode=OneWay}"
                   VKP="{Binding VKP,ElementName=TV,Mode=OneWay}"
                   />
        <VKP:TFVKP ORDERNUM="{Binding KEY,ElementName=TV}" Name="cVKP"/>
        <me:TVR05  Grid.Row="3" 
                   IsAuto="True"
                   VKP="{Binding KEY,ElementName=cVKP,Mode=OneWay}"/>
    </Grid>
</me:UIVRP>
